package main

import (
	"fmt"
	"time"
)

func main() {
	//x := make(chan int, 1)
	//go func() {
	//	x <- 1
	//	//time.Sleep(5 * time.Second)
	//
	//}()
	//
	//fmt.Println(<- x)


	//c := make(chan int)
	//
	//close(c)
	//
	//if v, ok := <-c; ok {
	//	fmt.Println(ok, v)
	//} else {
	//	fmt.Println(ok, v)
	//}

	ch1 := make(chan int)
	ch2 := make(chan int)

	go func() {
		ch1 <- 1
		fmt.Println("124")
		ch2 <- 2
	}()

	for  {
		select {
		case v, ok := <- ch1:
			fmt.Println(ok, v)
		case v, ok := <- ch2:
			fmt.Println(ok, v)
		}
	}

	time.Sleep(10 * time.Second)
}

